﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using Maticsoft.Common;
using LTP.Accounts.Bus;
namespace dzs.Web.tempskd
{
    public partial class Add : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
                       
        }

        		protected void btnSave_Click(object sender, EventArgs e)
		{
			
			string strErr="";
			if(this.txtproject.Text.Trim().Length==0)
			{
				strErr+="项目名不能为空！\\n";	
			}
			if(this.txtmaterial.Text.Trim().Length==0)
			{
				strErr+="物料不能为空！\\n";	
			}
			if(!PageValidate.IsDateTime(txttdate.Text))
			{
				strErr+="时间格式错误！\\n";	
			}
			if(this.txtttype.Text.Trim().Length==0)
			{
				strErr+="类型不能为空！\\n";	
			}
			if(!PageValidate.IsNumber(txtuid.Text))
			{
				strErr+="质量员ID格式错误！\\n";	
			}
			if(this.txtqresult.Text.Trim().Length==0)
			{
				strErr+="处理结果不能为空！\\n";	
			}

			if(strErr!="")
			{
				MessageBox.Show(this,strErr);
				return;
			}
			string project=this.txtproject.Text;
			string material=this.txtmaterial.Text;
			DateTime tdate=DateTime.Parse(this.txttdate.Text);
			string ttype=this.txtttype.Text;
			int uid=int.Parse(this.txtuid.Text);
			string qresult=this.txtqresult.Text;

			dzs.Model.tempskd model=new dzs.Model.tempskd();
			model.project=project;
			model.material=material;
			model.tdate=tdate;
			model.ttype=ttype;
			model.uid=uid;
			model.qresult=qresult;

			dzs.BLL.tempskd bll=new dzs.BLL.tempskd();
			bll.Add(model);
			Maticsoft.Common.MessageBox.ShowAndRedirect(this,"保存成功！","Add.aspx");

		}


        public void btnCancle_Click(object sender, EventArgs e)
        {
            Response.Redirect("list.aspx");
        }
    }
}
